 
 
 f u n c t i o n   G e t - W e b ( $ u r l ,   
 
         [ s w i t c h ] $ s e l f , 
 
         $ c r e d e n t i a l ,   
 
         $ t o F i l e , 
 
         [ s w i t c h ] $ b y t e s ) 
 
 { 
 
         $ w e b c l i e n t   =   N e w - O b j e c t   N e t . W e b c l i e n t 
 
         i f   ( $ c r e d e n t i a l )   { 
 
                 $ w e b C l i e n t . C r e d e n t i a l   =   $ c r e d e n t i a l 
 
         } 
 
         i f   ( $ s e l f )   { 
 
                 $ w e b C l i e n t . U s e D e f a u l t C r e d e n t i a l s   =   $ t r u e 
 
         } 
 
         i f   ( $ t o F i l e )   { 
 
                 i f   ( - n o t   " $ t o F i l e " . C o n t a i n s ( " : " ) )   { 
 
                         $ t o F i l e   =   J o i n - P a t h   $ p w d   $ t o F i l e 
 
                 } 
 
                 $ w e b C l i e n t . D o w n l o a d F i l e ( $ u r l ,   $ t o F i l e ) 
 
         }   e l s e   { 
 
                 i f   ( $ b y t e s )   { 
 
                         $ w e b C l i e n t . D o w n l o a d D a t a ( $ u r l ) 
 
                 }   e l s e   { 
 
                         $ w e b C l i e n t . D o w n l o a d S t r i n g ( $ u r l ) 
 
                 } 
 
         } 
 
 } 
 
 
 
 $ u r l R e g e x   =   ' ( ? s x ) < a \ s + [ ^ > ] + ? h r e f = " ( ? < U r l > [ ^ " ] + ) " ' 
 
 #   E R S A   h t t p s : / / w w w . a i r s e r v i c e s a u s t r a l i a . c o m / a i p / a i p . a s p ? p g = 4 0 & v d a t e = 2 6 - M a y - 2 0 1 6 & v e r = 1 
 
 #   A I P   h t t p s : / / w w w . a i r s e r v i c e s a u s t r a l i a . c o m / a i p / a i p . a s p ? p g = 2 0 & v d a t e = 2 6 - M a y - 2 0 1 6 & v e r = 1 
 
 #   A I C   h t t p s : / / w w w . a i r s e r v i c e s a u s t r a l i a . c o m / a i p / a i p . a s p ? p g = 5 0 
 
 
 
 
 
 # [ r e g e x ] : : M a t c h e s ( $ c o n t e n t ,   ' < a . * h r e f = " ( ? < u r l > [ ^ " ] * . p d f ) " ' )   |   f o r e a c h   {   $ _ . G r o u p s [ ' u r l ' ] . V a l u e   }   |   f o r e a c h   {   
 
 #         e c h o   $ s o u r c e   $ d e s t   
 
 #         $ s o u r c e   =   " h t t p s : / / w w w . a i r s e r v i c e s a u s t r a l i a . c o m / a i p / $ _ " 
 
 #         $ d e s t   =   " c : \ d a t a \ d o c u m e n t s \ a i p \ $ _ " 
 
 #         $ w e b c l i e n t . D o w n l o a d F i l e ( $ s o u r c e ,   $ d e s t ) 
 
 #         } 
 
 
 
 
 
 
 
 f u n c t i o n   G e t F A C ( ) 
 
 { 
 
         e c h o   ' ' 
 
         e c h o   ' G e t   F A C ' 
 
         e c h o   ' ' 
 
         
 
         $ c o n t e n t   =   G e t - W e b   " h t t p : / / w w w . a i r s e r v i c e s a u s t r a l i a . c o m / a i p / a i p . a s p ? p g = 4 0 & v d a t e = 2 6 - M a y - 2 0 1 6 & v e r = 1 " 
 
 
 
         #   e c h o   $ c o n t e n t 
 
         #   h t t p : / / w w w . a i r s e r v i c e s a u s t r a l i a . c o m / a i p / c u r r e n t / e r s a / F A C _ A D A C _ 2 6 - M a y - 2 0 1 6 . p d f 
 
 
 
         $ w e b c l i e n t   =   N e w - O b j e c t   N e t . W e b c l i e n t 
 
 
 
         [ r e g e x ] : : M a t c h e s ( $ c o n t e n t ,   ' < a . * h r e f = " ( ? < u r l > [ ^ < ] * . p d f ) " > F A C ' )   |   f o r e a c h   {   $ _ . G r o u p s [ ' u r l ' ] . V a l u e   }   |   f o r e a c h   {   
 
                 
 
                 $ f N a m e   =   $ _ 
 
                 #   e c h o   $ F N a m e 
 
                 $ f o u n d   =   [ r e g e x ] : : M a t c h e s ( $ f N a m e ,   " . * F A C _ ( ? ' C o d e ' [ A - Z ] { 4 } ) . * . p d f " ) 
 
                 i f   ( $ f o u n d [ 0 ] . S u c c e s s   - a n d   $ f o u n d [ 0 ] . G r o u p s [ ' C o d e ' ] . S u c c e s s )   { 
 
                         $ c o d e   =   $ f o u n d [ 0 ] . G r o u p s [ ' C o d e ' ] . V a l u e 
 
                         
 
                         $ d i r   =   ' c : \ d a t a \ P D F \ Y '   +   $ c o d e [ 1 ]   +   ' \ '   +   $ c o d e 
 
                         N e w - I t e m   - I t e m T y p e   D i r e c t o r y   - F o r c e   - P a t h   $ d i r   |   O u t - N u l l 
 
                           
 
                         $ d e s t   =   $ d i r   +   " \ F A C _ $ c o d e . p d f " 
 
                         $ s o u r c e   =   " h t t p s : / / w w w . a i r s e r v i c e s a u s t r a l i a . c o m $ f N a m e " 
 
                         e c h o   " D o w n l o a d i n g   $ d e s t   f r o m   $ s o u r c e " 
 
                         $ w e b c l i e n t . D o w n l o a d F i l e ( $ s o u r c e ,   $ d e s t ) 
 
                 } 
 
         
 
         } 
 
         e c h o   F A C   C o m p l e t e d 
 
 } 
 
 
 
 
 
 #   G e t A e r o C h a r t s 
 
     G e t F A C 
 
        